home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
PCSSP.LZH
/
PC-SSP.ZIP
/
STATMISC.ZIP
/
POINT.FOR
< prev
next >
Wrap
Text File
|
1985-12-31
|
4KB
|
133 lines
C
C ..................................................................
C
C SUBROUTINE POINT
C
C PURPOSE
C TO COMPUTE THE POINT-BISERIAL CORRELATION COEFFICIENT
C BETWEEN TWO VARIABLES, WHEN ONE OF THE VARIABLES IS A BINARY
C VARIABLE AND ONE IS CONTINUOUS. THIS IS A SPECIAL CASE OF
C THE PEARSON PRODUCT-MOMENT CORRELATION COEFFICIENT.
C
C USAGE
C CALL POINT (N,A,B,HI,ANS,IER)
C
C DESCRIPTION OF PARAMETERS
C N - NUMBER OF OBSERVATIONS
C A - INPUT VECTOR OF LENGTH N CONTAINING THE CONTINUOUS
C VARIABLE
C B - INPUT VECTOR OF LENGTH N CONTAINING THE DICHOTOMOUS
C (BINARY) VARIABLE
C HI - INPUT NUMERICAL CODE TO INDICATE THE HIGHER CATEGORY.
C ANY VALUE OF THE BINARY VARIABLE NOT LESS THAN HI WILL
C BE CLASSIFIED IN THE HIGHER OF THE TWO CATEGORIES.
C ANS - OUTPUT VECTOR OF LENGTH 9 CONTAINING THE FOLLOWING
C RESULTS
C ANS(1)- MEAN OF VARIABLE A
C ANS(2)- STANDARD DEVIATION OF VARIABLE A
C ANS(3)- NUMBER OF OBSERVATIONS IN THE HIGHER
C CATEGORY OF VARIABLE B
C ANS(4)- NUMBER OF OBSERVATIONS IN THE LOWER
C CATEGORY OF VARIABLE B
C ANS(5)- MEAN OF VARIABLE A FOR ONLY THOSE
C OBSERVATIONS IN THE HIGHER CATEGORY OF
C VARIABLE B
C ANS(6)- MEAN OF VARIABLE A FOR ONLY THOSE
C OBSERVATIONS IN THE LOWER CATEGORY OF
C VARIABLE B
C ANS(7)- POINT-BISERIAL CORRELATION COEFFICIENT
C ANS(8)- T-TEST FOR THE SIGNIFICANCE OF THE
C DIFFERENCE BETWEEN THE MEANS OF VARIABLE A
C FOR THE HIGHER AND LOWER CATEGORIES
C RESPECTIVELY.
C ANS(9)- DEGREES OF FREEDOM FOR THE T-TEST
C IER- 1, IF ALL ELEMENTS OF B ARE NOT LESS THAN HI.
C -1, IF ALL ELEMENTS OF B ARE LESS THAN HI.
C 0, OTHERWISE. IF IER IS NON-ZERO, ANS(I), I=5,...,9,
C IS SET TO 10**75.
C
C REMARKS
C THE SYMBOLS USED TO IDENTFY THE VALUES OF THE TWO CATEGORIES
C OF VARIABLE B MUST BE NUMERIC. ALPHABETIC OR SPECIAL
C CHARACTERS CANNOT BE USED.
C THE T-TEST(ANS(8)) IS A TEST OF WHETHER THE POINT-BISERIAL
C COEFFICIENT DIFFERS SIGNIFICANTLY FROM ZERO.
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C REFER TO P. HORST, 'PSYCHOLOGICAL MEASUREMENT AND
C PREDICTION', P. 91 (WADSWORTH, 1966).
C
C ..................................................................
C
SUBROUTINE POINT (N,A,B,HI,ANS,IER)
C
DIMENSION A(1),B(1),ANS(1)
C
C COMPUTE MEAN AND STANDARD DEVIATION OF VARIABLE A
C
IER=0
SUM=0.0
SUM2=0.0
DO 10 I=1,N
SUM=SUM+A(I)
10 SUM2=SUM2+A(I)*A(I)
FN=N
ANS(1)=SUM/FN
ANS(2)=(SUM2-ANS(1)*SUM)/(FN-1.0)
ANS(2)= SQRT(ANS(2))
C
C FIND NUMBERS OF CASES IN THE HIGHER AND LOWER CATEGORIES
C
P=0.0
SUM=0.0
SUM2=0.0
DO 30 I=1,N
IF(B(I)-HI) 20, 25, 25
20 SUM2=SUM2+A(I)
GO TO 30
25 P=P+1.0
SUM=SUM+A(I)
30 CONTINUE
C
Q=FN-P
ANS(3)=P
ANS(4)=Q
IF (P) 35,35,40
35 IER=-1
GO TO 50
40 ANS(5)=SUM/P
IF (Q) 45,45,60
45 IER=1
50 DO 55 I=5,9
55 ANS(I)=1.E38
GO TO 65
60 ANS(6)=SUM2/Q
C
C COMPUTE THE POINT-BISERIAL CORRELATION
C
R=((ANS(5)-ANS(1))/ANS(2))* SQRT(P/Q)
ANS(7)=R
C
C COMPUTE T RATIO USED TO TEST THE HYPOTHESIS OF ZERO CORRELATION
C
T=R* SQRT((FN-2.0)/(1.0-R*R))
ANS(8)=T
C
C COMPUTE DEGREES OF FREEDOM
C
ANS(9)=FN-2
C
65 RETURN
END
(I)
30 CONTINUE
C
Q=FN-P
ANS(3)=P
ANS(4)=Q
IF (P) 35,35,40
35 IER=-1
GO